<?php

namespace app\admin\model;

use think\Db;
use think\Model;
use traits\model\SoftDelete;

class Border extends Model
{

    use SoftDelete;

    

    // 表名
    protected $name = 'border';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
//    protected $deleteTime = 'deletetime';

    // 追加属性
    protected $append = [

    ];
    

    







    public function business()
    {
        return $this->belongsTo('Business', 'b_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }


    public function admin()
    {
        return $this->belongsTo('Admin', 'a_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }


    public function custom()
    {
        return $this->belongsTo('Custom', 'c_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }


    public function store()
    {
        return $this->belongsTo('Store', 's_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }

    public function getById($id) {
        return Db::name("border")->where('id', 'eq', $id)->find();
    }
}
